<template>
  <div class="app-container">
    <el-card class="box-card">
      <div id="print-div" class="mainBox" style="height: 1100px">
        <div
          style="
            text-align: center;
            font-size: 24px;
            font-weight: bold;
            margin-bottom: 8px;
          "
        >
          <img src="@/icons/img/changzhi.png" style="width: 40px; height: 40px" />
          {{ this.$store.state.City }}医院<br />
          连续性肾脏替代治疗（CRRT）护理记录单
        </div>
        <div class="warp">
          <div class="one">
            <div
              style="
                display: inline-flex;
                height: 30px;
                line-height: 30px;
                font-size: 14px;
                float: left;
                margin-left: 25px;
                margin-top: 4px;
              "
            >
              姓名：
              <span style="
                  width: 70px;
                  text-align: center;
                  border-bottom: 1px solid rgb(220, 222, 226);
                  height: 30px;
                  margin-right: 5px;
                "
              >{{ this.data.name }}</span>
              性别：
              <span
                style="
              width: 40px;
              text-align: center;
              border-bottom: 1px solid rgb(220, 222, 226);
              height: 30px;
              margin-right: 5px;
            "
              >{{ this.data.sex }}</span
              >
              年龄：
              <span style="
                    width: 60px;
                    text-align: center;
                    border-bottom: 1px solid rgb(220, 222, 226);
                    height: 30px;
                    margin-right: 5px;
                  "
              >{{ this.$store.state.user.severFall.ageOrMonthAge}}</span>
              床号：
              <span style="
              width: 60px;
              text-align: center;
              border-bottom: 1px solid rgb(220, 222, 226);
              height: 30px;
              margin-right: 5px;
            "
              >{{ this.data.bed_code }}</span>
              住院号：
              <span style="
              width: 150px;
              text-align: center;
              border-bottom: 1px solid rgb(220, 222, 226);
              height: 30px;
            "
              >{{ this.$store.state.user.severFall.visit_id }}</span>
            </div>
            <div
              style="
                display: inline-flex;
                height: 30px;
                line-height: 30px;
                font-size: 14px;
                float: left;
                margin-left: 25px;
              "
            >
              诊断：
              <input
                v-model="this.heimeisu"
                autocomplete="off"
                spellcheck="false"
                type="text"
                class="tiwenfeixing"
                style="width: 745px"
                maxlength="255"
              />
            </div>
            <div
              style="
                display: inline-flex;
                height: 30px;
                line-height: 30px;
                font-size: 14px;
                float: left;
                margin-left: 25px;
                margin-top: 5px;
              "
            >
              <!-- <span>
                转入科室：
                <el-select v-model="info.targetDepartment" clearable>
                  <el-option
                    v-for="item in listArr"
                    :key="item.id"
                    :label="item.name"
                    :value="item.name"
                  />
                </el-select>
              </span>
              <span style="margin-left: 160px">
                佩戴腕带：
                <el-checkbox-group v-model="info.wristTape">
                  <el-checkbox label="0">否</el-checkbox>
                  <el-checkbox label="1">是</el-checkbox>
                </el-checkbox-group>
              </span> -->
            </div>
            <div
              style="
                display: inline-flex;
                height: 30px;
                line-height: 30px;
                font-size: 14px;
                float: left;
                margin-left: 25px;
                width:400px;
              "
            >
              治疗日期：
              <el-date-picker
                v-model="info.cureDate"
                type="datetime"
                value-format="yyyy-MM-dd HH:mm:ss"
              />
            </div>
          </div>
          <div class="two">
            <h1>CRRT前评估:</h1>
            <div style="width: 100%; height: 45px; float: left">
              <div
                style="
                  width: 30%;
                  height: 45px;
                  float: left;
                  overflow: hidden;
                  line-height: 48px;
                  margin-left: 10px;
                "
              >
                机器型号：
                <input
                  v-model="info.machineModel"
                  autocomplete="off"
                  spellcheck="false"
                  type="text"
                  placeholder=""
                  class="tiwen"
                  style="left: 15px; width: 120px; padding-top: 14px"
                />
              </div>
              <div
                style="
                  width: 30%;
                  height: 45px;
                  float: left;
                  overflow: hidden;
                  line-height: 48px;
                  margin-left: 10px;
                "
              >
                置管部位：
                <input
                  v-model="info.catheteringPart"
                  autocomplete="off"
                  spellcheck="false"
                  type="text"
                  placeholder=""
                  class="tiwen"
                  style="left: 15px; width: 120px; padding-top: 14px"
                />
              </div>
              <div
                style="
                  width: 30%;
                  height: 45px;
                  float: left;
                  overflow: hidden;
                  line-height: 48px;
                  margin-left: 10px;
                "
              >
                血液滤过器：
                <input
                  v-model="info.hemofilter"
                  autocomplete="off"
                  spellcheck="false"
                  type="text"
                  placeholder=""
                  class="tiwen"
                  style="left: 15px; width: 120px; padding-top: 14px"
                />
              </div>
            </div>
            <div style="width: 100%; height: 45px; float: left">
              <div
                style="
                  width: 30%;
                  height: 45px;
                  float: left;
                  overflow: hidden;
                  line-height: 48px;
                  margin-left: 10px;
                "
              >
                神志：
                <input
                  v-model="info.mind"
                  autocomplete="off"
                  spellcheck="false"
                  type="text"
                  placeholder=""
                  class="tiwen"
                  style="left: 15px; width: 120px; padding-top: 14px"
                />
              </div>
              <div
                style="
                  width: 30%;
                  height: 45px;
                  float: left;
                  overflow: hidden;
                  line-height: 48px;
                  margin-left: 10px;
                "
              >
                收缩压：
                <input
                  v-model="info.systolicPressure"
                  autocomplete="off"
                  spellcheck="false"
                  type="text"
                  placeholder=""
                  class="tiwen"
                  style="left: 15px; width: 120px; padding-top: 14px"
                />mmHg
              </div>
              <div
                style="
                  width: 30%;
                  height: 45px;
                  float: left;
                  overflow: hidden;
                  line-height: 48px;
                  margin-left: 10px;
                "
              >
                舒张压：
                <input
                  v-model="info.diastolicPressure"
                  autocomplete="off"
                  spellcheck="false"
                  type="text"
                  placeholder=""
                  class="tiwen"
                  style="left: 15px; width: 120px; padding-top: 14px"
                />mmHg
              </div>
            </div>
            <div style="width: 100%; height: 45px; float: left">
              <div
                style="
                  width: 30%;
                  height: 45px;
                  float: left;
                  overflow: hidden;
                  line-height: 48px;
                  margin-left: 10px;
                "
              >
                心率：
                <input
                  v-model="info.heartRate"
                  autocomplete="off"
                  spellcheck="false"
                  type="text"
                  placeholder=""
                  class="tiwen"
                  style="left: 15px; width: 120px; padding-top: 14px"
                />次/分
              </div>
              <div
                style="
                  width: 30%;
                  height: 45px;
                  float: left;
                  overflow: hidden;
                  line-height: 48px;
                  margin-left: 10px;
                "
              >
                呼吸：
                <input
                  v-model="info.breathe"
                  autocomplete="off"
                  spellcheck="false"
                  type="text"
                  placeholder=""
                  class="tiwen"
                  style="left: 15px; width: 120px; padding-top: 14px"
                />次/分
              </div>
              <div
                style="
                  width: 30%;
                  height: 45px;
                  float: left;
                  overflow: hidden;
                  line-height: 48px;
                  margin-left: 10px;
                "
              >
                spo2：
                <input
                  v-model="info.spo2"
                  autocomplete="off"
                  spellcheck="false"
                  type="text"
                  placeholder=""
                  class="tiwen"
                  style="left: 15px; width: 120px; padding-top: 14px"
                />
              </div>
            </div>
            <div style="width: 100%; height: 45px; float: left">
              <div
                style="
                  width: 30%;
                  height: 45px;
                  float: left;
                  overflow: hidden;
                  line-height: 48px;
                  margin-left: 10px;
                "
              >
                透析液速度：
                <input
                  v-model="info.dialyzateVelocity"
                  autocomplete="off"
                  spellcheck="false"
                  type="text"
                  placeholder=""
                  class="tiwen"
                  style="left: 15px; width: 120px; padding-top: 14px"
                />L/H
              </div>
              <div
                style="
                  width: 30%;
                  height: 45px;
                  float: left;
                  overflow: hidden;
                  line-height: 48px;
                  margin-left: 10px;
                "
              >
                前置换速度：
                <input
                  v-model="info.beforeReplacementVelocity"
                  autocomplete="off"
                  spellcheck="false"
                  type="text"
                  placeholder=""
                  class="tiwen"
                  style="left: 15px; width: 120px; padding-top: 14px"
                />L/H
              </div>
              <div
                style="
                  width: 30%;
                  height: 45px;
                  float: left;
                  overflow: hidden;
                  line-height: 48px;
                  margin-left: 10px;
                "
              >
                后置换速度：
                <input
                  v-model="info.afterReplacementVelocity"
                  autocomplete="off"
                  spellcheck="false"
                  type="text"
                  placeholder=""
                  class="tiwen"
                  style="left: 15px; width: 120px; padding-top: 14px"
                />L/H
              </div>
            </div>
            <div style="width: 100%; height: 45px; float: left">
              <div
                style="
                  width: 30%;
                  height: 45px;
                  float: left;
                  overflow: hidden;
                  line-height: 48px;
                  margin-left: 10px;
                "
              >
                置换液补充后：
                <input
                  v-model="info.liquidReplenish"
                  autocomplete="off"
                  spellcheck="false"
                  type="text"
                  placeholder=""
                  class="tiwen"
                  style="left: 15px; width: 120px; padding-top: 14px"
                />%
              </div>
            </div>
            <div style="height: 70px; float: left; line-height: 40px">
              <h1>治疗措施：</h1>
            </div>
          </div>
          <div class="twohu">
            <div class="dongtai">
              <div
                style="
                  width: 25%;
                  text-align: center;
                  height: 90px;
                  line-height: 90px;
                  border-right: 1px solid #808695;
                  float: left;
                "
              >
                时间
              </div>
              <div
                style="
                  width: 50%;
                  text-align: center;
                  height: 90px;
                  line-height: 90px;
                  border-right: 1px solid #808695;
                  float: left;
                "
              >
                病情、护理措施及效果
              </div>
              <div
                style="
                  width: 25%;
                  text-align: center;
                  height: 90px;
                  line-height: 90px;
                  border-right: 1px solid #808695;
                  float: left;
                "
              >
                执行人
              </div>
            </div>
            <div
              class="dongtaibiaoge"
              v-for="item of info.crrtCureList"
              :key="item.id"
            >
              <div
                style="
                  width: 25%;
                  height: 45px;
                  line-height: 45px;
                  border-right: 1px solid #808695;
                  border-bottom: 1px solid #808695;
                  float: left;
                  overflow: hidden;
                "
              >
                <el-date-picker
                  v-model="item.cureTime"
                  type="datetime"
                  value-format="yyyy-MM-dd HH:mm:ss"
                />
              </div>
              <div
                style="
                  width: 50%;
                  text-align: center;
                  height: 45px;
                  line-height: 45px;
                  border-right: 1px solid #808695;
                  border-bottom: 1px solid #808695;
                  float: left;
                "
              >
                <input
                  v-model="item.content"
                  autocomplete="off"
                  spellcheck="false"
                  type="text"
                  placeholder=""
                  class="tiwengou"
                  style="left: 15px; width: 400px; margin-top: 18px"
                />
              </div>
              <div
                style="
                  width: 25%;
                  text-align: center;
                  height: 45px;
                  line-height: 45px;
                  border-right: 1px solid #808695;
                  border-bottom: 1px solid #808695;
                  float: left;
                  overflow: hidden;
                  line-height: 48px;
                "
              >
                <el-select v-model="item.operator" placeholder="" clearable>
                  <el-option
                    v-for="item in arrName"
                    :key="item.id"
                    :label="item.user_name"
                    :value="item.login_name"
                  />
                </el-select>
              </div>
            </div>
          </div>
          <h1>小结：</h1>
          <div class="dongtaibiaogeoooo">
            <div
              style="width: 40%; height: 45px; line-height: 45px; float: left"
            >
              开机时间：
              <el-date-picker
                v-model="info.startTime"
                type="datetime"
                value-format="yyyy-MM-dd HH:mm:ss"
              />
            </div>
            <div
              style="
                width: 50%;
                text-align: center;
                height: 45px;
                line-height: 45px;
                float: left;
              "
            >
              上机护士：
              <el-select v-model="info.upNurse" placeholder="" clearable>
                <el-option
                  v-for="item in arrName"
                  :key="item.id"
                  :label="item.user_name"
                  :value="item.login_name"
                />
              </el-select>
            </div>
          </div>
          <div class="dongtaibiaogeoooo">
            <div
              style="width: 40%; height: 45px; line-height: 45px; float: left"
            >
              关机时间：
              <el-date-picker
                v-model="info.closeTime"
                type="datetime"
                value-format="yyyy-MM-dd HH:mm:ss"
              />
            </div>
            <div
              style="
                width: 50%;
                text-align: center;
                height: 45px;
                line-height: 45px;
                float: left;
              "
            >
              下机护士：
              <el-select v-model="info.downNurse" placeholder="" clearable>
                <el-option
                  v-for="item in arrName"
                  :key="item.id"
                  :label="item.user_name"
                  :value="item.login_name"
                />
              </el-select>
            </div>
          </div>
          <div class="twojizaizitianji">
            <div
              style="width: 940px; height: 36px; line-height: 30px; float: left"
            ></div>
          </div>
          <!-- <div class="five">
            <div
              style="
                float: left;
                width: 93px;
                height: 240px;
                border-right: 1px solid #808695;
                padding-top: 19px;
                text-align: center;
              "
            >
              患者安全
            </div>
            <div
              style="
                width: 193px;
                height: 240px;
                border-right: 1px solid #808695;
                float: left;
                padding-top: 5px;
                margin-left: 5px;
              "
            >
              <el-checkbox-group v-model="info.huanzheone">
                <el-checkbox label="1" class="tianji">跌倒</el-checkbox>
                <el-checkbox label="2" class="tianji">烫伤</el-checkbox>
                <el-checkbox label="3" class="tianji"> 坠床</el-checkbox>
                <el-checkbox label="4" class="tianji">导管滑脱</el-checkbox>
                <el-checkbox label="5" class="tianji">误吸</el-checkbox>
                <el-checkbox label="6" class="tianji">静脉炎</el-checkbox>
                <el-checkbox label="7" class="tianji">自伤</el-checkbox>
                <el-checkbox label="8" class="tianjisss">其它</el-checkbox>
              </el-checkbox-group>
              <span style="float: left; margin-left: 56px; margin-top: -18px">
                <input
                  v-model="info.feisi"
                  autocomplete="off"
                  spellcheck="false"
                  type="text"
                  class="tiwen"
                  style="left: 17px; width: 100px"
                />
              </span>
            </div>
            <div
              style="width: 541px; height: 115px; float: left; margin-left: 5px"
            >
              <el-checkbox-group v-model="info.huanzhetwo">
                <el-checkbox label="1" class="tianji"
                  >床头警示，穿防滑鞋，行动有陪伴，用助行工具，勤巡视</el-checkbox
                >
                <el-checkbox label="2" class="tianji"
                  >床头警示，温水袋外裹毛巾，水温不超过50，加强巡视</el-checkbox
                >
                <el-checkbox label="3" class="tianji">
                  床头警示，加床栏，必要时用保护性约束，加强巡视</el-checkbox
                >
                <el-checkbox label="4" class="tianji"
                  >妥善固定导管，移动病人时注意导管位置，加强巡视</el-checkbox
                >
                <el-checkbox label="5" class="tianji"
                  >床头抬高30 - 45，从健侧喂食，头偏向一侧，</el-checkbox
                >
                <el-checkbox label="6" class="tianji"
                  >严格执行无菌操作，遵守操作规程</el-checkbox
                >
                <el-checkbox label="7" class="tianji"
                  >加强看护，各班认真交接</el-checkbox
                >
                <el-checkbox class="tianjisss"></el-checkbox>
              </el-checkbox-group>
              <span style="float: left; margin-left: 26px; margin-top: -18px">
                <input
                  v-model="info.gousi"
                  autocomplete="off"
                  spellcheck="false"
                  type="text"
                  class="tiwen"
                  style="width: 445px"
                  maxlength="255"
                />
              </span>
            </div>
          </div> -->
          <!-- <div
            style="
              width: 940px;
              height: 189px;
              margin-top: 39px;
              text-align: center;
            "
          >
            <span class="tianjitwo">评估时间：</span
            ><span class="tianjitwo">
              <input
                v-model="info.yearss"
                autocomplete="off"
                spellcheck="false"
                type="text"
                class="tiwen"
                style="width: 45px"
                maxlength="255"
              />
              年</span
            ><span class="tianjitwo">
              <input
                v-model="info.yuess"
                autocomplete="off"
                spellcheck="false"
                type="text"
                class="tiwen"
                style="width: 45px"
                maxlength="255"
              />月</span
            >
            <span class="tianjitwo">
              <input
                v-model="info.riss"
                autocomplete="off"
                spellcheck="false"
                type="text"
                class="tiwen"
                style="width: 45px"
                maxlength="255"
              />日</span
            >
            <span class="tianjitwo">
              <input
                v-model="info.shiss"
                autocomplete="off"
                spellcheck="false"
                type="text"
                class="tiwen"
                style="width: 45px"
                maxlength="255"
              />时</span
            >
            <span class="tianjitwo">
              <input
                v-model="info.fenss"
                autocomplete="off"
                spellcheck="false"
                type="text"
                class="tiwen"
                style="width: 45px"
                maxlength="255"
              />分</span
            >
            <span class="tianjitwos"
              >责任护士:
              <el-select
                v-model="info.transferNurseSignature"
                placeholder=""
                clearable
              >
                <el-option
                  v-for="item in arrName"
                  :key="item.id"
                  :label="item.user_name"
                  :value="item.login_name"
                /> </el-select
            ></span>
          </div> -->
        </div>
      </div>
      <div
        style="
          position: fixed;
          right: 0;
          bottom: 0;
          z-index: 9;
          width: 100%;
          height: 56px;
          line-height: 56px;
          padding: 0 60px 0 18px;
          background: #fff;
          border-top: 1px solid #e8eaec;
          box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.03);
        "
      >
        <el-button
          type="primary"
          style="position: absolute; right: 20px; top: 8px"
          @click="btn"
          >保存</el-button
        >

        <el-button
          type="primary"
          style="position: absolute; right: 102px; top: 8px"
          @click="daying"
          >打印</el-button
        >
        <el-button
          type="primary"
          style="position: absolute; right: 185px; top: 8px"
          @click="reload"
          >刷新</el-button
        >

        <el-button
          type="primary"
          style="position: absolute; right: 270px; top: 8px"
          @click="histion()"
          >历史记录</el-button
        >
      </div>
      <el-drawer title="评估列表" :visible.sync="table" direction="rtl">
        <el-table :data="gridData">
          <el-table-column
            label="序号"
            type="index"
            align="center"
            width="100"
          />
          <el-table-column
            property="cureDate"
            label="治疗日期"
            width="250"
            align="center"
          />
          <el-table-column label="操作" width="154" align="center">
            <template slot-scope="scope">
              <el-button
                slot="reference"
                size="mini"
                style="margin-left: 10px"
                type="primary"
                @click="choice(scope)"
                >选择</el-button
              >
              <el-popover
                :ref="`popover-${scope.$index}`"
                trigger="click"
                placement="top"
                width="100"
              >
                <p class="el-icon-warning">确定删除</p>
                <div style="text-align: right; margin: 0">
                  <el-button size="mini" type="text" @click="no(scope)"
                    >取消</el-button
                  >
                  <el-button type="primary" size="mini" @click="yes(scope)"
                    >确定</el-button
                  >
                </div>
                <el-button
                  slot="reference"
                  size="mini"
                  style="margin-left: 10px"
                  type="danger"
                  >删除</el-button
                >
              </el-popover>
            </template>
          </el-table-column>
        </el-table>
      </el-drawer>
    </el-card>
  </div>
</template>

<script>
import { printExcel } from "@/utils/config"; // 导入模块
import { jyxdPagePrint } from "@/utils/jyxd-page-printer.js";
import {
  getPatientSource,
  getUserListByUserType,
  patientgetList,
  transferAssessmentSaveData,
  transferAssessmentGetList,
  transferAssessmentDeleteData,
  transferAssessmentChooseData,
  patientRiskAssessinsert,
  queryListByPatientId,
  patientRiskAssessgetData,
  patientRiskAssessdeleteData,
  getBedPatientList,
  dibaotianxinggai,
  yachuanginsert,
  queryListByPatientIdyachuang,
  queryListByPatientIdyachuanggetData,
  crrtAccessqueryData,
  crrtAccessdelete,
  patientRiskAssessdeleteyachuang,
  crrtAccessinsert,
  crrtAccessqueryList,
} from "@/api/table";
import { Message } from "element-ui";
import { edit } from "../../api/table";
export default {
  data() {
    return {
      printParam: {
        print_id: "print-div", //完整打印区域最外包裹, id名
        paper_height: "1240", //纸张长度，目前不自动分页，页面代码自行设计分页模式
        paper_width: "850", //纸张宽度，根据横向纵向调整，影响页面折行效果
        preview: "",
      },

      dialogVisible: false,
      data: {},
      age:"",
      listArr: [],
      arrName: [],
      yinping: "",
      table: false,
      listarrs: [],
      heimeisu: "",
      gridData: [],
      options: [
        {
          value: "选项1",
          label: "1",
          description:
            "提供足够的灯光，清楚病房、床旁及通道障碍，在夜间使用夜灯，加强巡视及时满足患者要求",
        },
        {
          value: "选项2",
          label: "2",
          description: "教会患者使用床头灯及呼吸灯，告知患者及时寻求协助的方法",
        },
        {
          value: "选项3",
          label: "3",
          description: "告知患者并指导患者及家属服用特殊药物注意事项",
        },
        {
          value: "选项4",
          label: "4",
          description: "床头悬挂“防跌倒”、“防坠床”警示牌，严格交接班",
        },
        {
          value: "选项5",
          label: "5",
          description:
            "保持公共区域或地面无水渍，湿润地板要有醒目标志，指导患者穿适宜防滑鞋",
        },
        {
          value: "选项6",
          label: "6",
          description:
            "将呼吸灯（确保患者可用）、床头灯、电话、眼镜、助听器等和其它常用物品放于患者伸手可及范围内",
        },
        {
          value: "选项7",
          label: "7",
          description: "使用床挡或保护性约束",
        },
        {
          value: "选项8",
          label: "8",
          description:
            "指导患者渐近坐起，渐进下床的方法（“三步”起床发），即：平躺30秒，坐起30秒，站立30秒再走，对于偏瘫患者指导应山健侧边床缘上下床",
        },
        {
          value: "选项9",
          label: "9",
          description:
            "告知家属无论患者在卧床或下床活动时，都应随时陪伴在患者身旁，尽量穿防滑鞋，禁止穿一次性拖鞋",
        },
      ],
      info: {
        cureDate: "",
        machineModel: "",
        catheteringPart: "",
        hemofilter: "",
        mind: "",
        systolicPressure: "",
        diastolicPressure: "",
        heartRate: "",
        breathe: "",
        spo2: "",
        dialyzateVelocity: "",
        beforeReplacementVelocity: "",
        afterReplacementVelocity: "",
        liquidReplenish: "",
        startTime: "",
        closeTime: "",
        upNurse: "",
        downNurse: "",
        crrtCureList: [
          {
            content: "",
            crrtAssessId: "",
            cureTime: "",
            id: "",
            operator: "",
            status: 0,
          },
          {
            content: "",
            crrtAssessId: "",
            cureTime: "",
            id: "",
            operator: "",
            status: 0,
          },
          {
            content: "",
            crrtAssessId: "",
            cureTime: "",
            id: "",
            operator: "",
            status: 0,
          },
          {
            content: "",
            crrtAssessId: "",
            cureTime: "",
            id: "",
            operator: "",
            status: 0,
          },
          {
            content: "",
            crrtAssessId: "",
            cureTime: "",
            id: "",
            operator: "",
            status: 0,
          },
          {
            content: "",
            crrtAssessId: "",
            cureTime: "",
            id: "",
            operator: "",
            status: 0,
          },
          {
            content: "",
            crrtAssessId: "",
            cureTime: "",
            id: "",
            operator: "",
            status: 0,
          },
          {
            content: "",
            crrtAssessId: "",
            cureTime: "",
            id: "",
            operator: "",
            status: 0,
          },
          {
            content: "",
            crrtAssessId: "",
            cureTime: "",
            id: "",
            operator: "",
            status: 0,
          },
          {
            content: "",
            crrtAssessId: "",
            cureTime: "",
            id: "",
            operator: "",
            status: 0,
          },
        ],
      },
    };
  },
  computed: {
    getData() {
      return this.$store.state.user.severFall;
    },
  },
  watch: {
    getData: {
      handler(nVal) {
        if (this.$store.state.user.severFall == undefined) {
          this.$message({
            message: "请先选择病人",
            type: "warning",
          });
        } else {
          this.data = this.$store.state.user.severFall;
          this.info.diagnosisName = this.data.diagnosis_name;
          this.info.sourceDepartment = this.data.department_name;
          this.info.visitId = this.data.visit_id;
          this.info.visitCode = this.data.visit_code;
          this.info.patientId = this.data.patient_id;

          this.setDiagnosis_nameNew();
          if(this.data.unplanned=="" || this.data.unplanned==null || this.data.unplanned==0){
            this.$message({
              message: "请在首页补全患者信息",
              type: "warning",
              duration: 1500
            });
          }
        }
      },
      deep: true,
    },
  },
    created() {
      this.data = this.$store.state.user.severFall;
            patientgetList({ visitId: this.data.visit_id }).then((res) => {
        if(res.data[0].age!==''){
          this.age = res.data[0].age;
        }
    });
  },
  mounted() {
    this.getNowDate();
    this.data = this.$store.state.user.severFall;
    if (
      typeof this.data.patient_id != "string" ||
      this.data.patient_id.length < 1
    ) {
      alert("请选择一次病人");
    } else {
      this.huli();
    }
                patientgetList({ visitId: this.data.visit_id }).then((res) => {
        if(res.data[0].age!==''){
          this.age = res.data[0].age;
        }
    });
    getBedPatientList().then((res) => {
      this.listarrs = res.data;
      for(let ji=0;ji<this.listarrs.length;ji++) {
          this.listarrs[ji].visit_code=this.listarrs[ji].visit_id;
        }
      console.log(this.listarrs, 654);
    });
    var date = new Date();
    // 年
    var year = date.getFullYear();
    // 月
    var month = date.getMonth() + 1;
    // 日
    var day = date.getDate();
    // 时
    var hh = date.getHours();
    // 分
    var mm = date.getMinutes();
    // 秒
    var ss = date.getSeconds();
    if (Number(month) < 10) {
      month = "0" + month;
    }
    if (Number(hh) < 10) {
      hh = "0" + hh;
    }
    if (Number(mm) < 10) {
      mm = "0" + mm;
    }
    if (Number(ss) < 10) {
      ss = "0" + ss;
    }
    this.info.yearss = year;
    this.info.yuess = month;
    this.info.riss = day;
    this.info.shiss = hh;
    this.info.fenss = mm;

    this.setDiagnosis_nameNew();
  },
  methods: {
    huli() {
      this.data = this.$store.state.user.severFall;
      (this.info.visitId = this.data.visit_id),
        (this.info.diagnosisName = this.data.diagnosis_name),
        (this.info.visitCode = this.data.visit_code),
        (this.info.patientId = this.data.patient_id);
      getPatientSource().then((res) => {
        this.listArr = res.data;
      });
      // 签名
      getUserListByUserType().then((res) => {
        this.arrName = res.data;
      });
      this.setDiagnosis_nameNew();
      if(this.data.unplanned=="" || this.data.unplanned==null || this.data.unplanned==0){
        this.$message({
          message: "请在首页补全患者信息",
          type: "warning",
          duration: 1500
        });
      }
    },
    //赋值诊断信息
    setDiagnosis_nameNew() {
      patientgetList({ visitId: this.info.visitId }).then((res) => {
          this.heimeisu = res.data[0].diagnosis_name;
      });
    },

    // 刷新
    reload() {
      this.info = {
        cureDate: "",
        machineModel: "",
        catheteringPart: "",
        hemofilter: "",
        mind: "",
        systolicPressure: "",
        diastolicPressure: "",
        heartRate: "",
        breathe: "",
        spo2: "",
        dialyzateVelocity: "",
        beforeReplacementVelocity: "",
        afterReplacementVelocity: "",
        liquidReplenish: "",
        startTime: "",
        closeTime: "",
        upNurse: "",
        downNurse: "",
        crrtCureList: [
          {
            content: "",
            crrtAssessId: "",
            cureTime: "",
            id: "",
            operator: "",
            status: 0,
          },
          {
            content: "",
            crrtAssessId: "",
            cureTime: "",
            id: "",
            operator: "",
            status: 0,
          },
          {
            content: "",
            crrtAssessId: "",
            cureTime: "",
            id: "",
            operator: "",
            status: 0,
          },
          {
            content: "",
            crrtAssessId: "",
            cureTime: "",
            id: "",
            operator: "",
            status: 0,
          },
          {
            content: "",
            crrtAssessId: "",
            cureTime: "",
            id: "",
            operator: "",
            status: 0,
          },
          {
            content: "",
            crrtAssessId: "",
            cureTime: "",
            id: "",
            operator: "",
            status: 0,
          },
          {
            content: "",
            crrtAssessId: "",
            cureTime: "",
            id: "",
            operator: "",
            status: 0,
          },
          {
            content: "",
            crrtAssessId: "",
            cureTime: "",
            id: "",
            operator: "",
            status: 0,
          },
          {
            content: "",
            crrtAssessId: "",
            cureTime: "",
            id: "",
            operator: "",
            status: 0,
          },
          {
            content: "",
            crrtAssessId: "",
            cureTime: "",
            id: "",
            operator: "",
            status: 0,
          },
        ],
      };
      if (
        typeof this.data.patient_id != "string" ||
        this.data.patient_id.length < 1
      ) {
        alert("请选择一次病人");
      } else {
        this.huli();
      }
      this.setDiagnosis_nameNew();
    },
    getNowDate() {
      var date = new Date();
      // 年
      var year = date.getFullYear();
      // 月
      var month = date.getMonth() + 1;
      // 日
      var day = date.getDate();
      // 时
      var hh = date.getHours();
      // 分
      var mm = date.getMinutes();
      // 秒
      var ss = date.getSeconds();
      if (Number(hh) < 10) {
        hh = "0" + hh;
      }
      if (Number(mm) < 10) {
        mm = "0" + mm;
      }
      if (Number(ss) < 10) {
        ss = "0" + ss;
      }
      this.info.dataTime =
        year + "-" + month + "-" + day + " " + hh + ":" + mm + ":" + ss;
    },
    daying() {
      if (
        typeof this.data.patient_id != "string" ||
        this.data.patient_id.length < 1
      ) {
        alert("请选择一次病人");
      } else {
        jyxdPagePrint(this.printParam);
      }

      //this.dialogVisible=true
    },
    btnClickPrint() {
      printExcel("tableId");
    },
    btn() {
      if (
        typeof this.data.patient_id != "string" ||
        this.data.patient_id.length < 1
      ) {
        alert("请选择一次病人");
      } else {
        if (!this.info.patientId) {
          this.info.patientId = this.data.patient_id;
        }
        // crrtAccessinsert(this.info).then((res) => {});
        // this.$store.commit("user/SET_severFall", {
        //   diagnosis_name: this.info.diagnosisName,
        // });
        const info = JSON.parse(JSON.stringify(this.info));
        // info.huanzhetwo = info.huanzhetwo.join(",");
        // info.yufangdengji = info.yufangdengji.join(",");
        // info.yufangdengjis = info.yufangdengjis.join(",");
        // info.yufangdengjid = info.yufangdengjid.join(",");
        // info.yufangdengjif = info.yufangdengjif.join(",");
        // info.yufangdengjig = info.yufangdengjig.join(",");
        // info.yufangdengjih = info.yufangdengjih.join(",");
        // info.yufangdengjij = info.yufangdengjij.join(",");
        // info.assessment_Id = this.yinping;
        console.log(info, "打木架看");
        crrtAccessinsert(this.info).then((res) => {
          if (res.code === 200) {
            this.$message({
              message: "保存成功",
              type: "success",
            });
          } else {
            this.$message({
              message: "保存失败",
              type: "success",
            });
          }
        });
      }
    },
    histion() {
      if (
        typeof this.data.patient_id != "string" ||
        this.data.patient_id.length < 1
      ) {
        alert("请选择一次病人");
      } else {
        this.table = true;
        console.log(this.data.patient_id, "你是冰狗");
        if (this.data.patient_id) {
          crrtAccessqueryList({
            patientId: this.data.patient_id,
          }).then((res) => {
            this.gridData = res.data;
          });
        }
      }
    },
    // 选择
    choice(scope) {
      console.log(scope);
      const ids = scope.row.id;
      this.yinping = scope.row.id;
      crrtAccessqueryData({
        status: 1,
        patientId: this.data.patient_id,
        id: ids,
      }).then((res) => {
        this.info = res.data;
      });
    },
    yes(scope) {
      // 可以在这里执行删除数据的回调操作.......删除操作......
      crrtAccessdelete({
        id: scope.row.id,
      }).then((res) => {
        this.$message({
          message: "删除成功",
          type: "success",
        });
        this.histion();
      });
      scope._self.$refs[`popover-${scope.$index}`].doClose();
    },
    no(scope) {
      this.$message("取消删除");
      scope._self.$refs[`popover-${scope.$index}`].doClose();
    },
    clickChange() {
      console.log(this.info.drainageTubeList, "11111");
    },
  },
};
</script>

<style scoped>
.xiang {
  position: absolute;
  top: 40px;
  margin-top: 15px;
  display: inline;
}
.nei {
  top: 0;
  position: absolute;
  left: 60px;
  margin-top: 15px;
  display: inline;
}
.tianji {
  display: flex;

  margin-top: 6px;
}
.tianjitwo {
  margin-right: 50px;
  display: inline-block;
}
.tianjitwos {
  margin-top: 10px;
  display: inline-block;
}
.tianjisss {
  display: flex;
  width: 50px;
  margin-top: 6px;
}

::v-deep .el-tag .el-icon-close {
  width: 0;
  height: 0;
  display: none;
}
::v-deep .el-tag .el-icon-close::before {
  width: 0;
  height: 0;
  display: none;
}
::v-deep .el-tag--small {
  padding: 0;
  color: black;
}
::v-deep .el-input__icon {
  line-height: 32px !important;
}
::v-deep .el-input__inner {
  height: 30px !important;
  width: 100%;
  padding-left: 2px;
}
::v-deep .el-input__icon.el-icon-time {
  display: none;
  width: 0;
  height: 0;
}
::v-deep .el-select__caret.el-input__icon.el-icon-arrow-up {
  display: none;
  width: 0;
  height: 0;
}
::v-deep .el-select__tags-text {
  font-size: 12px;
}
.line {
  text-align: center;
}
.block {
  position: absolute;
  top: 39px;
  right: 14%;
}
.warp {
  width: 940px;
  height: auto;
  border: 1px solid #808695;
  margin: 0 auto;
}
.one {
  width: 940px;
  height: 103px;
  border-bottom: 1px solid #808695;
}
.one /deep/ .el-input__inner {
  width: 186px !important;
}
.two {
  width: 940px;
  height: 380px;
  border-bottom: 1px solid #808695;
}
.twodehuahua {
  width: 940px;
  height: 270px;
  border-bottom: 1px solid #808695;
}
.twohu {
  width: 940px;
  height: 540px;
  border-bottom: 1px solid #808695;
}
.twojizaizipanduan {
  width: 940px;
  height: 20px;
  border-bottom: 1px solid #808695;
}
.twojizaizipanduansss {
  width: 940px;
  height: 40px;
  border-bottom: 1px solid #808695;
}
.dongtai {
  width: 940px;
  height: 90px;
  border-bottom: 1px solid #808695;
}
.dongtaibiaoge {
  width: 940px;
  height: 45px;
  border-bottom: 1px solid #808695;
}
.dongtaibiaogeoooo {
  width: 940px;
  height: 45px;
}
.laolong {
  width: 847px;
  height: 45px;
  line-height: 45px;
  border-bottom: 1px solid #808695;
  float: right;
}
.laolongdlas {
  width: 847px;
  height: 25px;
  line-height: 25px;
  border-bottom: 1px solid #808695;
  float: right;
}
.laolongtwo {
  width: 847px;
  height: 70px;
  line-height: 70px;
  border-bottom: 1px solid #808695;
  float: right;
}
.laolongthree {
  width: 847px;
  height: 100px;
  line-height: 100px;
  border-bottom: 1px solid #808695;
  float: right;
}
.twotwo {
  width: 939px;
  height: 85px;
  border-bottom: 1px solid #808695;
}
.two /deep/ .el-input__inner {
  border: none;
  width: 220px;
  border-bottom: 1px solid #808695;
}
.three {
  width: 940px;
  height: 176px;
  border-bottom: 1px solid #808695;
}
.three /deep/ .el-input__inner {
  border: none;
  width: 220px;
  border-bottom: 1px solid #808695;
}
.four {
  width: 940px;
  height: 159px;
  border-bottom: 1px solid #808695;
}
.five {
  width: 940px;
  height: 240px;
  border-bottom: 1px solid #808695;
}
.six {
  width: 940px;
  height: 126px;
  border-bottom: 1px solid #808695;
}
.twojizaizitianji {
  width: 940px;
  height: 36px;
  border-bottom: 1px solid #808695;
}
.seven {
  width: 840px;
  height: 71px;
}
.one /deep/ .el-input__inner {
  border: none;
  width: 120px;
  border-bottom: 1px solid #dcdfe6;
}
.tiwen {
  border: 0px;
  border-bottom: 1px solid rgb(220, 222, 226);
  outline: none;
  text-align: center;
}
.tiwengou {
  border: 0px;
  border-bottom: 1px solid rgb(220, 222, 226);
  outline: none;
}
.tiwenfeixing {
  border: 0px;
  border-bottom: 1px solid rgb(220, 222, 226);
  outline: none;
}
.che /deep/ .el-checkbox {
  margin-bottom: 10px;
}
.zhuan /deep/ .el-input__inner {
  border: none;
  width: 220px;
  height: 30px;
  border-bottom: 1px solid #dcdfe6;
}
.sp .el-checkbox {
  display: block;
  margin-bottom: 15px;
}
</style>

